home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13654 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.4 KB  |  63 lines

  1. Path: mail2news.demon.co.uk!willen.demon.co.uk
  2. From: Adrian Parker <adrian@willen.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: watcom c 10.5.. bug ?
  5. Date: Tue, 09 Apr 96 16:00:04 GMT
  6. Organization: Quondam Ltd
  7. Message-ID: <829065604snz@willen.demon.co.uk>
  8. Reply-To: adrian@willen.demon.co.uk
  9. X-NNTP-Posting-Host: willen.demon.co.uk
  10. X-Newsreader: Demon Internet Simple News v1.30
  11. X-Mail2News-Path: willen.demon.co.uk
  12.  
  13.  
  14. Compiler is watcom 10.5a.
  15.  
  16. I have a problem with a program I've been writing, and have tracked it 
  17. down to the following..
  18.  
  19. ......................................................................
  20. #include <stdio.h>
  21. #include <stdlib.h>
  22.  
  23. struct {
  24.     char c1[15];
  25.     int i1;
  26.     char c2[4];
  27. } array[101][101];
  28.  
  29. main()
  30. {
  31.     printf("c1 %p\n",array[30][90].c1);
  32.     printf("c2 %p\n",array[30][90].c2);
  33. /*    
  34.     array[30][90].i1 = 1;
  35. */
  36. }
  37. ......................................................................
  38.  
  39. Compiling & running from msdos with   wcl work.c -ml -w4
  40.  
  41. -ml = large model
  42. -w4 = show all warnings
  43.  
  44. The output I get is..
  45.  
  46. c1 1f99:fff0
  47. c2 2f99:0001
  48.  
  49. So it looks like the int variable array[30][90].i1 is crossing a
  50. segment boundary. 
  51.  
  52. If the last line is uncommented, it just hangs. 
  53.  
  54. Has anyone else had any problems with this compiler doing odd things 
  55. with memory ?
  56.  
  57. Rgards,
  58. Adrian
  59. -- 
  60. :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: ::
  61. :: Adrian Parker  adrian@willen.demon.co.uk  Quondam Ltd ::
  62. :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: :: ::
  63.